package com.jh.paymentchannel.pojo.enums;

import org.apache.commons.lang3.StringUtils;

/**
 * by zhuguolong in 2018.11.16
 * 扫码支付返回结果
 */
public enum CmMicroPayStatus {
    SUCCESS("SUCCESS", "支付成功"),
    FAIL("FAIL", "支付失败"),
    PAYING("PAYING", "支付中")
    ;
    private String value;
    private String desc;
    CmMicroPayStatus(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public String getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    public static <T extends String> CmMicroPayStatus of(T n) {
        String val;
        if (StringUtils.isEmpty(n)) {
            return null;
        }

        val = n;
        for (CmMicroPayStatus microPayStatus : values()) {
            if (microPayStatus.getValue().equals(val)) {
                return microPayStatus;
            }
        }
        return null;
    }
}
